package com.guanzi.big_data_mq_process.util;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;

@Data
@Accessors(chain = true)
public class PageResult<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    private Long pageNum;
    private Long pageSize;
    private Long total;
    private List<T> data;

    public PageResult(IPage<T> data) {
        this.total = data.getTotal();
        this.pageNum = data.getCurrent();
        this.pageSize = data.getSize();
        this.data = data.getRecords();
    }

    public PageResult() {}
}
